package com.ruoyi.project.system.service.impl;

import java.util.List;

import com.ruoyi.project.system.domain.SysMobileUser;
import com.ruoyi.project.system.mapper.SysMobileUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.system.mapper.SysPariseMapper;
import com.ruoyi.project.system.domain.SysParise;
import com.ruoyi.project.system.service.ISysPariseService;

/**
 * 平台瞬间点赞Service业务层处理
 * 
 * @author jjp
 * @date 2020-04-14
 */
@Service
public class SysPariseServiceImpl implements ISysPariseService 
{
    @Autowired
    private SysPariseMapper sysPariseMapper;

    @Autowired
    private SysMobileUserMapper sysMobileUserMapper;

    /**
     * 查询平台瞬间点赞
     * 
     * @param pariseId 平台瞬间点赞ID
     * @return 平台瞬间点赞
     */
    @Override
    public SysParise selectSysPariseById(Long pariseId)
    {
        return sysPariseMapper.selectSysPariseById(pariseId);
    }

    /**
     * 查询平台瞬间点赞列表
     * 
     * @param sysParise 平台瞬间点赞
     * @return 平台瞬间点赞
     */
    @Override
    public List<SysParise> selectSysPariseList(SysParise sysParise)
    {
        return sysPariseMapper.selectSysPariseList(sysParise);
    }


    /**
     * 查询平台瞬间点赞列表
     *
     * @param momentId 平台瞬间点赞
     * @return 平台瞬间点赞
     */
    @Override
    public List<SysParise> selectSysPariseMomentId(Long momentId)
    {
        List<SysParise> sysParises = sysPariseMapper.selectSysPariseMomentId(momentId);
        for (int i = 0; i < sysParises.size(); i++) {
            Long mobileUserId = sysParises.get(i).getMobileUserId();
            SysMobileUser sysMobileUser = sysMobileUserMapper.selectSysMobileUserById(mobileUserId);
            String userName = sysMobileUser.getUserName();
            sysParises.get(i).setUserName(userName);
        }
        return sysParises;
    }

    /**
     * 新增平台瞬间点赞
     * 
     * @param sysParise 平台瞬间点赞
     * @return 结果
     */
    @Override
    public int insertSysParise(SysParise sysParise)
    {
        return sysPariseMapper.insertSysParise(sysParise);
    }

    /**
     * 修改平台瞬间点赞
     * 
     * @param sysParise 平台瞬间点赞
     * @return 结果
     */
    @Override
    public int updateSysParise(SysParise sysParise)
    {
        return sysPariseMapper.updateSysParise(sysParise);
    }

    /**
     * 批量删除平台瞬间点赞
     * 
     * @param pariseIds 需要删除的平台瞬间点赞ID
     * @return 结果
     */
    @Override
    public int deleteSysPariseByIds(Long[] pariseIds)
    {
        return sysPariseMapper.deleteSysPariseByIds(pariseIds);
    }

    /**
     * 删除平台瞬间点赞信息
     * 
     * @param pariseId 平台瞬间点赞ID
     * @return 结果
     */
    @Override
    public int deleteSysPariseById(Long pariseId)
    {
        return sysPariseMapper.deleteSysPariseById(pariseId);
    }

    @Override
    public Integer selectCount(SysParise sysParise) {
        return sysPariseMapper.selectCount(sysParise);
    }

    @Override
    public int deleteSysPariseByMobileUserId(SysParise sysParise) {
        return sysPariseMapper.deleteSysPariseByMobileUserId(sysParise);
    }

    @Override
    public List<SysParise> selectSysParise(SysParise sysParise) {
        return sysPariseMapper.selectSysParise(sysParise);
    }
}
